//
// Created by yanhai on 2021/11/4.
//

#pragma once

#include "utility/hashthread/hash_table_thread.h"

struct Packet : public HashTableThreadValue {
    unsigned int src_addr{0};
    unsigned int dst_addr{0};

    unsigned short src_port{0};
    unsigned short dst_port{0};

    unsigned int proto{0};

    unsigned int flow_hash{0};

    unsigned int time{0};

    unsigned int Hash() override
    {
        return flow_hash;
    }
};

Packet *PacketAlloc(unsigned int src_addr, unsigned int dst_addr,
                    unsigned short src_port, unsigned short dst_port,
                    unsigned int time);
void PacketFree(Packet *p);
